﻿using Microsoft.AspNetCore.Mvc;
using TaskModel;

namespace WebApplication3.Controllers
{
    public class GanttController : Controller
    {



        [HttpGet]
        public IActionResult GetTasks()
        {
            var tasks = new[]
            {
            new TaskModels
            {
                Name = "Task 1",
                Start = (long)new DateTime(2024, 12, 11).ToUniversalTime().Subtract(DateTime.UnixEpoch).TotalMilliseconds,
                End = (long)new DateTime(2024, 12, 18).ToUniversalTime().Subtract(DateTime.UnixEpoch).TotalMilliseconds,
                Color = "#FF0000",
                Children = new List<TaskModels>
                {
                    new TaskModels
                    {
                        Name = "Subtask 1.1",
                        Start = (long) new DateTime(2024, 12, 12).ToUniversalTime().Subtract(DateTime.UnixEpoch).TotalMilliseconds,
                        End = (long) new DateTime(2024, 12, 14).ToUniversalTime().Subtract(DateTime.UnixEpoch).TotalMilliseconds,
                        Color = "#00FF00"
                    }
                }
            }
        };

            return Json(tasks);
        }




        public IActionResult indexs()
        {

            return View();
        }

        public IActionResult Index()
        {
            var tasks = new List<GanttTask>
           {
               new GanttTask
               {
                   Title = "Task 1",
                   Start = DateTime.Now,
                   End = DateTime.Now.AddDays(3)
               },
               new GanttTask
               {
                   Title = "Task 2",
                   Start = DateTime.Now.AddDays(1),
                   End = DateTime.Now.AddDays(4)
               }
           };
            return View(tasks);
        }
    }
    

}
